package com.code.monitor.conditions;

import com.code.monitor.constants.RuntimeType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

@Slf4j
public class MemoryRuntimeCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String runtime = context.getEnvironment().getProperty("runtime");
        return runtime == null || RuntimeType.MEMORY.getType().equalsIgnoreCase(runtime);
    }
}
